home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb.new / gdb-4.0 / gdb / gdb.info-2 < prev    next >
Encoding:
Text File  |  1991-08-24  |  48.7 KB  |  1,238 lines

  1. Info file gdb.info, produced by Makeinfo, -*- Text -*- from input
  2. file gdb-all.texi.
  3.  
  4.    This file documents the GNU debugger GDB.
  5.  
  6.    Copyright (C) 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
  7.  
  8.    Permission is granted to make and distribute verbatim copies of
  9. this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.  
  13.    Permission is granted to copy and distribute modified versions of
  14. this
  15. manual under the conditions for verbatim copying, provided also that
  16. the section entitled "GNU General Public License" is included
  17. exactly as in the original, and provided that the entire resulting
  18. derived work is distributed under the terms of a permission notice
  19. identical to this one.
  20.  
  21.    Permission is granted to copy and distribute translations of this
  22. manual into another language, under the above conditions for
  23. modified versions, except that the section entitled "GNU General
  24. Public License" may be included in a translation approved by the
  25. Free Software Foundation instead of in the original English.
  26.  
  27. 
  28. File: gdb.info,  Node: Breakpoints,  Next: Continuing and Stepping,  Prev: Stopping,  Up: Stopping
  29.  
  30. Breakpoints, Watchpoints, and Exceptions
  31. ========================================
  32.  
  33.    A "breakpoint" makes your program stop whenever a certain point in
  34. the program is reached.  For each breakpoint, you can add various
  35. conditions to control in finer detail whether the program will stop.
  36. You can set breakpoints with the `break' command and its variants
  37. (*note Set Breaks::.), to specify the place where the program should
  38. stop by line number, function name or exact address in the program. 
  39. In languages with exception handling (such as GNU C++), you can also
  40. set breakpoints  where an exception is raised (*note Exception
  41. Handling::.).
  42.  
  43.    A "watchpoint" is a special breakpoint that stops your program
  44. when the value of an expression changes.  You must use a different
  45. command to set watchpoints (*note Set Watchpoints::.), but aside
  46. from that, you can manage a watchpoint like any other breakpoint:
  47. you enable, disable, and delete both breakpoints and watchpoints
  48. using the same commands.
  49.  
  50.    Each breakpoint or watchpoint is assigned a number when it is
  51. created; these numbers are successive integers starting with one. 
  52. In many of the commands for controlling various features of
  53. breakpoints you use the breakpoint number to say which breakpoint
  54. you want to change.  Each breakpoint may be "enabled" or "disabled";
  55. if
  56. disabled, it has no effect on the program until you enable it again.
  57.  
  58. * Menu:
  59.  
  60. * Set Breaks::                  Setting Breakpoints
  61. * Set Watchpoints::             Setting Watchpoints
  62. * Exception Handling::          Breakpoints and Exceptions
  63. * Delete Breaks::               Deleting Breakpoints
  64. * Disabling::                   Disabling Breakpoints
  65. * Conditions::                  Break Conditions
  66. * Break Commands::              Breakpoint Command Lists
  67. * Breakpoint Menus::            Breakpoint Menus
  68. * Error in Breakpoints::
  69.  
  70. 
  71. File: gdb.info,  Node: Set Breaks,  Next: Set Watchpoints,  Prev: Breakpoints,  Up: Breakpoints
  72.  
  73. Setting Breakpoints
  74. -------------------
  75.  
  76.    Breakpoints are set with the `break' command (abbreviated `b').
  77.  
  78.    You have several ways to say where the breakpoint should go.
  79.  
  80. `break FUNCTION'
  81.      Set a breakpoint at entry to function FUNCTION.  When using
  82.      source languages that permit overloading of symbols, such as
  83.      C++, FUNCTION may refer to more than one possible place to break.
  84.      *Note Breakpoint Menus::, for a discussion of that situation.
  85.  
  86. `break +OFFSET'
  87. `break -OFFSET'
  88.      Set a breakpoint some number of lines forward or back from the
  89.      position at which execution stopped in the currently selected
  90.      frame.
  91.  
  92. `break LINENUM'
  93.      Set a breakpoint at line LINENUM in the current source file. 
  94.      That file is the last file whose source text was printed.  This
  95.      breakpoint will stop the program just before it executes any of
  96.      the code on that line.
  97.  
  98. `break FILENAME:LINENUM'
  99.      Set a breakpoint at line LINENUM in source file FILENAME.
  100.  
  101. `break FILENAME:FUNCTION'
  102.      Set a breakpoint at entry to function FUNCTION found in file
  103.      FILENAME.  Specifying a file name as well as a function name is
  104.      superfluous except when multiple files contain similarly named
  105.      functions.
  106.  
  107. `break *ADDRESS'
  108.      Set a breakpoint at address ADDRESS.  You can use this to set
  109.      breakpoints in parts of the program which do not have debugging
  110.      information or source files.
  111.  
  112. `break'
  113.      When called without any arguments, `break' sets a breakpoint at
  114.      the next instruction to be executed in the selected stack frame
  115.      (*note Stack::.).  In any selected frame but the innermost,
  116.      this will cause the program to stop as soon as control returns
  117.     
  118.      to that frame.  This is similar to the effect of a `finish'
  119.      command in the frame inside the selected frame--except that
  120.      `finish' doesn't leave an active breakpoint.  If you use
  121.      `break' without an argument in the innermost frame, GDB will
  122.      stop the next time it reaches the current location; this may be
  123.      useful inside loops.
  124.  
  125.      GDB normally ignores breakpoints when it resumes execution,
  126.      until at least one instruction has been executed.  If it did
  127.      not do this, you would be unable to proceed past a breakpoint
  128.      without first disabling the breakpoint.  This rule applies
  129.      whether or not the breakpoint already existed when the program
  130.      stopped.
  131.  
  132. `break ... if COND'
  133.      Set a breakpoint with condition COND; evaluate the expression
  134.      COND each time the breakpoint is reached, and stop only if the
  135.      value is nonzero--that is, if COND evaluates as true.  `...'
  136.      stands for one of the possible arguments described above (or no
  137.      argument) specifying where to break.  *Note Conditions::, for
  138.      more information on breakpoint conditions.
  139.  
  140. `tbreak ARGS'
  141.      Set a breakpoint enabled only for one stop.  ARGS are the same
  142.      as for the `break' command, and the breakpoint is set in the
  143.      same way, but the breakpoint is automatically disabled the
  144.      first time it is hit.  *Note Disabling::.
  145.  
  146. `rbreak REGEX'
  147.      Set breakpoints on all functions matching the regular expression
  148.      REGEX.  This command sets an unconditional breakpoint on all
  149.      matches, printing a list of all breakpoints it set. Once these
  150.      breakpoints are set, they are treated just like the breakpoints
  151.      set with the `break' command.  They can be deleted, disabled,
  152.      made conditional, etc., in the standard ways.
  153.  
  154.      When debugging C++ programs, `rbreak' is useful for setting
  155.      breakpoints on overloaded functions that are not members of any
  156.      special classes.
  157.  
  158. `info breakpoints [N]'
  159. `info break [N]'
  160.      Print a list of all breakpoints (but not watchpoints) set and
  161.      not deleted, showing their numbers, where in the program they
  162.      are, and any special features in use for them. Disabled
  163.      breakpoints are included in the list, but marked as disabled.
  164.      `info break' with a breakpoint number N as argument lists only
  165.      that breakpoint.  The convenience variable `$_' and the default
  166.     
  167.      examining-address for the `x' command are set to the address of
  168.      the last breakpoint listed (*note Memory::.).  The equivalent
  169.      command for watchpoints is `info watch'.
  170.  
  171.    GDB allows you to set any number of breakpoints at the same place
  172. in the program.  There is nothing silly or meaningless about this. 
  173. When the breakpoints are conditional, this is even useful (*note
  174. Conditions::.).
  175.  
  176. 
  177. File: gdb.info,  Node: Set Watchpoints,  Next: Exception Handling,  Prev: Set Breaks,  Up: Breakpoints
  178.  
  179. Setting Watchpoints
  180. -------------------
  181.  
  182.    You can use a watchpoint to stop execution whenever the value of
  183. an expression changes, without having to predict a particular place 
  184. where this may happen.
  185.  
  186.    Watchpoints currently execute two orders of magnitude more slowly
  187. than other breakpoints, but this can well be worth it to catch
  188. errors where you have no clue what part of your program is the
  189. culprit.  Some processors provide special hardware to support
  190. watchpoint evaluation; future releases of GDB will use such hardware
  191. if it is available.
  192.  
  193. `watch EXPR'
  194.      Set a watchpoint for an expression.
  195.  
  196. `info watchpoints'
  197.      This command prints a list of watchpoints; it is otherwise
  198.      similar to `info break'.
  199.  
  200. 
  201. File: gdb.info,  Node: Exception Handling,  Next: Delete Breaks,  Prev: Set Watchpoints,  Up: Breakpoints
  202.  
  203. Breakpoints and Exceptions
  204. --------------------------
  205.  
  206.    Some languages, such as GNU C++, implement exception handling. 
  207. You can use GDB to examine what caused the program to raise an
  208. exception, and to list the exceptions the program is prepared to
  209. handle at a given point in time.
  210.  
  211. `catch EXCEPTIONS'
  212.      You can set breakpoints at active exception handlers by using
  213.      the `catch' command.  EXCEPTIONS is a list of names of
  214.      exceptions to catch.
  215.  
  216.    You can use `info catch' to list active exception handlers; *note
  217. Frame Info::..
  218.  
  219.    There are currently some limitations to exception handling in GDB.
  220. These will be corrected in a future release.
  221.  
  222.    * If you call a function interactively, GDB normally returns
  223.      control to you when the function has finished executing.  If
  224.      the call raises an exception, however, the call may bypass the
  225.      mechanism that returns control to the user and cause the
  226.      program to simply continue running until it hits a breakpoint,
  227.      catches a signal that GDB is listening for, or exits.
  228.  
  229.    * You cannot raise an exception interactively.
  230.  
  231.    * You cannot interactively install an exception handler.
  232.  
  233.    Sometimes `catch' is not the best way to debug exception handling:
  234. if you need to know exactly where an exception is raised, it's
  235. better to stop *before* the exception handler is called, since that
  236. way you can see the stack before any unwinding takes place.  If you
  237. set a breakpoint in an exception handler instead, it may not be easy
  238. to find out where the exception was raised.
  239.  
  240.    To stop just before an exception handler is called, you need some
  241. knowledge of the implementation.  In the case of GNU C++, exceptions
  242. are raised by calling a library function named `__raise_exception'
  243. which has the following ANSI C interface:
  244.  
  245.          /* ADDR is where the exception identifier is stored.
  246.             ID is the exception identifier.  */
  247.          void __raise_exception (void **ADDR, void *ID);
  248.  
  249. To make the debugger catch all exceptions before any stack unwinding
  250. takes place, set a breakpoint on `__raise_exception' (*note
  251. Breakpoints::.).
  252.  
  253.    With a conditional breakpoint (*Note Conditions::) that depends on
  254. the value of ID, you can stop your program when a specific exception
  255. is raised.  You can use multiple conditional breakpoints to stop the
  256. program when any of a number of exceptions are raised.
  257.  
  258. 
  259. File: gdb.info,  Node: Delete Breaks,  Next: Disabling,  Prev: Exception Handling,  Up: Breakpoints
  260.  
  261. Deleting Breakpoints
  262. --------------------
  263.  
  264.    It is often necessary to eliminate a breakpoint or watchpoint once
  265. it has done its job and you no longer want the program to stop
  266. there.  This is called "deleting" the breakpoint.  A breakpoint that
  267. has been deleted no longer exists; it is forgotten.
  268.  
  269.    With the `clear' command you can delete breakpoints according to
  270. where they are in the program.  With the `delete' command you can
  271. delete individual breakpoints or watchpoints by specifying their
  272. breakpoint numbers.
  273.  
  274.    It is not necessary to delete a breakpoint to proceed past it. 
  275. GDB automatically ignores breakpoints on the first instruction to be
  276. executed when you continue execution without changing the execution
  277. address.
  278.  
  279. `clear'
  280.      Delete any breakpoints at the next instruction to be executed in
  281.      the selected stack frame (*note Selection::.).  When the
  282.      innermost frame is selected, this is a good way to delete a
  283.      breakpoint that the program just stopped at.
  284.  
  285. `clear FUNCTION'
  286. `clear FILENAME:FUNCTION'
  287.      Delete any breakpoints set at entry to the function FUNCTION.
  288.  
  289. `clear LINENUM'
  290. `clear FILENAME:LINENUM'
  291.      Delete any breakpoints set at or within the code of the
  292.      specified line.
  293.  
  294. `delete [breakpoints] [BNUMS...]'
  295.      Delete the breakpoints or watchpoints of the numbers specified
  296.      as arguments.  If no argument is specified, delete all
  297.      breakpoints (GDB asks confirmation, unless you've `set confirm
  298.      off').  You can abbreviate this command as `d'.
  299.  
  300. 
  301. File: gdb.info,  Node: Disabling,  Next: Conditions,  Prev: Delete Breaks,  Up: Breakpoints
  302.  
  303. Disabling Breakpoints
  304. ---------------------
  305.  
  306.    Rather than deleting a breakpoint or watchpoint, you might prefer
  307. to "disable" it.  This makes the breakpoint inoperative as if it had
  308. been deleted, but remembers the information on the breakpoint so
  309. that you can "enable" it again later.
  310.  
  311.    You disable and enable breakpoints and watchpoints with the
  312. `enable' and `disable' commands, optionally specifying one or more
  313. breakpoint numbers as arguments.  Use `info break' or `info watch'
  314. to print a list of breakpoints or watchpoints if you don't know
  315. which numbers to use.
  316.  
  317.    A breakpoint or watchpoint can have any of four different states
  318. of enablement:
  319.  
  320.    * Enabled.  The breakpoint will stop the program.  A breakpoint
  321.      set with the `break' command starts out in this state.
  322.  
  323.    * Disabled.  The breakpoint has no effect on the program.
  324.  
  325.    * Enabled once.  The breakpoint will stop the program, but when it
  326.      does so it will become disabled.  A breakpoint set with the
  327.      `tbreak' command starts out in this state.
  328.  
  329.    * Enabled for deletion.  The breakpoint will stop the program, but
  330.      immediately after it does so it will be deleted permanently.
  331.  
  332.    You can use the following commands to enable or disable
  333. breakpoints and watchpoints:
  334.  
  335. `disable [breakpoints] [BNUMS...]'
  336.      Disable the specified breakpoints--or all breakpoints, if none
  337.      are listed.  A disabled breakpoint has no effect but is not
  338.      forgotten.  All options such as ignore-counts, conditions and
  339.      commands are remembered in case the breakpoint is enabled again
  340.      later.  You may abbreviate `disable' as `dis'.
  341.  
  342. `enable [breakpoints] [BNUMS...]'
  343.      Enable the specified breakpoints (or all defined breakpoints). 
  344.      They become effective once again in stopping the program.
  345.  
  346. `enable [breakpoints] once BNUMS...'
  347.      Enable the specified breakpoints temporarily.  Each will be
  348.      disabled again the next time it stops the program.
  349.  
  350. `enable [breakpoints] delete BNUMS...'
  351.      Enable the specified breakpoints to work once and then die. 
  352.      Each of the breakpoints will be deleted the next time it stops
  353.      the program.
  354.  
  355.    Save for a breakpoint set with `tbreak' (*note Set Breaks::.),
  356. breakpoints that you set are initially enabled; subsequently, they
  357. become disabled or enabled only when you use one of the commands
  358. above.  (The command `until' can set and delete a breakpoint of its
  359. own,
  360. but it will not change the state of your other breakpoints; *note
  361. Continuing and Stepping::..)
  362.  
  363. 
  364. File: gdb.info,  Node: Conditions,  Next: Break Commands,  Prev: Disabling,  Up: Breakpoints
  365.  
  366. Break Conditions
  367. ----------------
  368.  
  369.    The simplest sort of breakpoint breaks every time the program
  370. reaches a specified place.  You can also specify a "condition" for a
  371. breakpoint.  A condition is just a Boolean expression in your
  372. programming language.  (*Note Expressions::).  A breakpoint with a
  373. condition evaluates the expression each time the program reaches it,
  374. and the program stops only if the condition is *true*.
  375.  
  376.    This is the converse of using assertions for program validation;
  377. in that situation, you want to stop when the assertion is
  378. violated--that is, when the condition is false.  In C, if you want
  379. to test an assertion expressed by the condition ASSERT, you should
  380. set the condition  `! ASSERT' on the appropriate breakpoint.
  381.  
  382.    Conditions are also accepted for watchpoints; you may not need
  383. them, since a watchpoint is inspecting the value of an expression
  384. anyhow--but it might be simpler, say, to just set a watchpoint on a
  385. variable name, and specify a condition that tests whether the new
  386. value is an interesting one.
  387.  
  388.    Break conditions ca have side effects, and may even call functions
  389. in your program.  This can be useful, for example, to activate
  390. functions that log program progress, or to use your own print
  391. functions to format special data structures. The effects are
  392. completely
  393. predictable unless there is another enabled breakpoint at the same
  394. address.  (In that case, GDB might see the other breakpoint first
  395. and stop the program without checking the condition of this one.) 
  396. Note that breakpoint commands are usually more convenient and
  397. flexible for the purpose of performing side effects when a
  398. breakpoint is reached (*note Break Commands::.).
  399.  
  400.    Break conditions can be specified when a breakpoint is set, by
  401. using `if' in the arguments to the `break' command.  *Note Set
  402. Breaks::.  They can also be changed at any time with the `condition'
  403. command.  The `watch' command doesn't recognize the `if' keyword;
  404. `condition' is the only way to impose a further condition on a
  405. watchpoint.
  406.  
  407. `condition BNUM EXPRESSION'
  408.      Specify EXPRESSION as the break condition for breakpoint or
  409.      watchpoint number BNUM.  From now on, this breakpoint will stop
  410.      the program only if the value of EXPRESSION is true (nonzero,
  411.      in C).  When you use `condition', GDB checks EXPRESSION
  412.      immediately for syntactic correctness, and to determine whether
  413.      symbols in it have referents in the context of your breakpoint.
  414.      GDB does not actually evaluate EXPRESSION at the time the
  415.      `condition' command is given, however.  *Note Expressions::.
  416.  
  417. `condition BNUM'
  418.      Remove the condition from breakpoint number BNUM.  It becomes an
  419.      ordinary unconditional breakpoint.
  420.  
  421.    A special case of a breakpoint condition is to stop only when the
  422. breakpoint has been reached a certain number of times.  This is so
  423. useful that there is a special way to do it, using the "ignore
  424. count" of the breakpoint.  Every breakpoint has an ignore count,
  425. which is an integer.  Most of the time, the ignore count is zero,
  426. and therefore has no effect.  But if the program reaches a
  427. breakpoint whose ignore count is positive, then instead of stopping,
  428. it just decrements the ignore count by one and continues.  As a
  429. result,
  430. if the ignore count value is N, the breakpoint will not stop the
  431. next N times it is reached.
  432.  
  433. `ignore BNUM COUNT'
  434.      Set the ignore count of breakpoint number BNUM to COUNT.  The
  435.      next COUNT times the breakpoint is reached, your program's
  436.      execution will not stop; other than to decrement the ignore
  437.      count, GDB takes no action.
  438.  
  439.      To make the breakpoint stop the next time it is reached, specify
  440.      a count of zero.
  441.  
  442. `continue COUNT'
  443. `c COUNT'
  444. `fg COUNT'
  445.      Continue execution of the program, setting the ignore count of
  446.      the breakpoint that the program stopped at to COUNT minus one. 
  447.      Thus, the program will not stop at this breakpoint until the
  448.      COUNT'th time it is reached.
  449.  
  450.      An argument to this command is meaningful only when the program
  451.      stopped due to a breakpoint.  At other times, the argument to
  452.      `continue' is ignored.
  453.  
  454.      The synonym `fg' is provided purely for convenience, and has
  455.      exactly the same behavior as other forms of the command.
  456.  
  457.    If a breakpoint has a positive ignore count and a condition, the
  458. condition is not checked.  Once the ignore count reaches zero, the
  459. condition will be checked.
  460.  
  461.    You could achieve the effect of the ignore count with a condition
  462. such as `$foo-- <= 0' using a debugger convenience variable that is
  463. decremented each time.  *Note Convenience Vars::.
  464.  
  465. 
  466. File: gdb.info,  Node: Break Commands,  Next: Breakpoint Menus,  Prev: Conditions,  Up: Breakpoints
  467.  
  468. Breakpoint Command Lists
  469. ------------------------
  470.  
  471.    You can give any breakpoint (or watchpoint) a series of commands
  472. to execute when the program stops due to that breakpoint.  For
  473. example, you might want to print the values of certain expressions,
  474. or enable other breakpoints.
  475.  
  476. `commands [BNUM]'
  477. `... COMMAND-LIST ...'
  478. `end'
  479.      Specify a list of commands for breakpoint number BNUM.  The
  480.      commands themselves appear on the following lines.  Type a line
  481.      containing just `end' to terminate the commands.
  482.  
  483.      To remove all commands from a breakpoint, type `commands'
  484.      followed immediately by `end'; that is, give no commands.
  485.  
  486.      With no BNUM argument, `commands' refers to the last breakpoint
  487.      or watchpoint set (not to the breakpoint most recently
  488.      encountered).
  489.  
  490.    Pressing RET as a means of repeating the last GDB command is
  491. disabled within a COMMAND-LIST.
  492.  
  493.    You can use breakpoint commands to start the program up again. 
  494. Simply use the `continue' command, or `step', or any other command
  495. that resumes execution.  Subsequent commands in the command list are
  496. ignored.
  497.  
  498.    If the first command specified is `silent', the usual message
  499. about stopping at a breakpoint is not printed.  This may be
  500. desirable for breakpoints that are to print a specific message and
  501. then continue.  If the remaining commands too print nothing, you
  502. will see no sign that the breakpoint was reached at all.  `silent'
  503. is meaningful only  at the beginning of a breakpoint command list.
  504.  
  505.    The commands `echo' and `output' that allow you to print precisely
  506. controlled output are often useful in silent breakpoints.  *Note
  507. Output::.
  508.  
  509.    For example, here is how you could use breakpoint commands to
  510. print the value of `x' at entry to `foo' whenever `x' is positive.
  511.  
  512.      break foo if x>0
  513.      commands
  514.      silent
  515.      echo x is\040
  516.      output x
  517.      echo \n
  518.      cont
  519.      end
  520.  
  521.    One application for breakpoint commands is to compensate for one
  522. bug so you can test for another.  Put a breakpoint just after the
  523. erroneous line of code, give it a condition to detect the case in
  524. which something erroneous has been done, and give it commands to
  525. assign correct values to any variables that need them.  End with the
  526. `continue' command so that the program does not stop, and start with
  527. the `silent' command so that no output is produced.  Here is an
  528. example:
  529.  
  530.      break 403
  531.      commands
  532.      silent
  533.      set x = y + 4
  534.      cont
  535.      end
  536.  
  537.    One deficiency in the operation of automatically continuing
  538. breakpoints under Unix appears when your program uses raw mode for
  539. the
  540. terminal.  GDB switches back to its own terminal modes (not raw)
  541. before executing commands, and then must switch back to raw mode
  542. when your program is continued.  This causes any pending terminal
  543. input to be lost.
  544.  
  545.    Under Unix, you can get around this problem by writing actions
  546. into the breakpoint condition rather than in commands.  For example
  547.  
  548.      condition 5  (x = y + 4), 0
  549.  
  550. specifies a condition expression (*Note Expressions::) that will
  551. change `x' as needed, then always have the value zero so the program
  552. will not stop.  No input is lost here, because GDB evaluates break
  553. conditions  without changing the terminal modes.  When you want to
  554. have nontrivial conditions for performing the side effects, the
  555. operators `&&', `||' and `?...:' may be useful.
  556.  
  557. 
  558. File: gdb.info,  Node: Breakpoint Menus,  Next: Error in Breakpoints,  Prev: Break Commands,  Up: Breakpoints
  559.  
  560. Breakpoint Menus
  561. ----------------
  562.  
  563.    Some programming languages (notably C++) permit a single function
  564. name to be defined several times, for application in different
  565. contexts.  This is called "overloading".  When a function name is
  566. overloaded, `break FUNCTION' is not enough to tell GDB where you
  567. want a breakpoint.  GDB offers you a menu of numbered choices for
  568. different possible breakpoints, and waits for your selection with
  569. the prompt `>'.  The first two options are always `[0] cancel' and
  570. `[1] all'.  Typing `1' sets a breakpoint at each definition of
  571. FUNCTION, and typing `0' aborts the `break' command without setting
  572. any new breakpoints.
  573.  
  574.    For example, the following session excerpt shows an attempt to set
  575. a breakpoint at the overloaded symbol `String::after'.   We choose
  576. three particular definitions of that function name:
  577.  
  578.      (gdb) b String::after
  579.      [0] cancel
  580.      [1] all
  581.      [2] file:String.cc; line number:867
  582.      [3] file:String.cc; line number:860
  583.      [4] file:String.cc; line number:875
  584.      [5] file:String.cc; line number:853
  585.      [6] file:String.cc; line number:846
  586.      [7] file:String.cc; line number:735
  587.      > 2 4 6
  588.      Breakpoint 1 at 0xb26c: file String.cc, line 867.
  589.      Breakpoint 2 at 0xb344: file String.cc, line 875.
  590.      Breakpoint 3 at 0xafcc: file String.cc, line 846.
  591.      Multiple breakpoints were set.
  592.      Use the "delete" command to delete unwanted breakpoints.
  593.      (gdb)
  594.  
  595. 
  596. File: gdb.info,  Node: Error in Breakpoints,  Prev: Breakpoint Menus,  Up: Breakpoints
  597.  
  598. "Cannot Insert Breakpoints"
  599. ---------------------------
  600.  
  601.    Under some operating systems, breakpoints cannot be used in a
  602. program if any other process is running that program.  In this
  603. situation, attempting to run or continue a program with a breakpoint
  604. causes GDB to stop the other process.
  605.  
  606.    When this happens, you have three ways to proceed:
  607.  
  608.   1. Remove or disable the breakpoints, then continue.
  609.  
  610.   2. Suspend GDB, and copy the file containing the program to a new
  611.      name.  Resume GDB and use the `exec-file' command to specify
  612.      that GDB should run the program under that name.  Then start
  613.      the program again.
  614.  
  615.   3. Relink the program so that the text segment is nonsharable,
  616.      using the linker option `-N'.  The operating system limitation
  617.      may not apply to nonsharable executables.
  618.  
  619. 
  620. File: gdb.info,  Node: Continuing and Stepping,  Next: Signals,  Prev: Breakpoints,  Up: Stopping
  621.  
  622. Continuing and Stepping
  623. =======================
  624.  
  625.    "Continuing" means resuming program execution until your program
  626. completes normally.  In contrast, "stepping" means resuming program
  627. execution for a very limited time: one line of source code, or one
  628. machine instruction.  Either when continuing or when stepping, the
  629. program may stop even sooner, due to a breakpoint or to a signal. 
  630. (If due to a signal, you may want to use `handle', or use `signal 0'
  631. to resume execution; *note Signals::..)
  632.  
  633. `continue [IGNORE-COUNT]'
  634.      Resume program execution, at the address where the program last
  635.      stopped; any breakpoints set at that address are bypassed.  The
  636.      optional argument IGNORE-COUNT allows you to specify a further
  637.      number of times to ignore a breakpoint at this location; its
  638.      effect is like that of `ignore' (*note Conditions::.).
  639.  
  640.      To resume execution at a different place, you can use `return'
  641.      (*note Returning::.) to go back to the calling function; or
  642.      `jump' (*note Jumping::.) to go to an arbitrary location in
  643.      your program.
  644.  
  645.    A typical technique for using stepping is to set a breakpoint
  646. (*note Breakpoints::.) at the beginning of the function or the
  647. section of the program in which a problem is believed to lie, run
  648. the program until it stops at that breakpoint, and then step through
  649. the suspect area, examining the variables that are interesting,
  650. until you see the problem happen.
  651.  
  652. `step'
  653.      Continue running the program until control reaches a different
  654.      source line, then stop it and return control to GDB.  This
  655.      command is abbreviated `s'.
  656.  
  657.           *Warning:* If you use the `step' command while control is
  658.           within a function that was compiled without debugging
  659.           information, execution will proceed until control reaches
  660.           another function.
  661.  
  662. `step COUNT'
  663.      Continue running as in `step', but do so COUNT times.  If a
  664.      breakpoint is reached or a signal not related to stepping
  665.      occurs before COUNT steps, stepping stops right away.
  666.  
  667. `next [COUNT]'
  668.      Continue to the next source line in the current (innermost)
  669.      stack frame.  Similar to `step', but any function calls
  670.      appearing within the line of code are executed without
  671.      stopping.  Execution stops when control reaches a different
  672.      line of code at the stack level which was executing when the
  673.     
  674.      `next' command was given.  This command is abbreviated `n'.
  675.  
  676.      An argument COUNT is a repeat count, as for `step'.
  677.  
  678.      `next' within a function that lacks debugging information acts
  679.      like `step', but any function calls appearing within the code
  680.      of the function are executed without stopping.
  681.  
  682. `finish'
  683.      Continue running until just after function in the selected stack
  684.      frame returns.  Print the returned value (if any).
  685.  
  686.      Contrast this with the `return' command (*note Returning::.).
  687.  
  688. `until'
  689. `u'
  690.      Continue running until a source line past the current line, in
  691.      the current stack frame, is reached.  This command is used to
  692.      avoid single stepping through a loop more than once.  It is
  693.      like the `next' command, except that when `until' encounters a
  694.      jump, it automatically continues execution until the program
  695.      counter is greater than the address of the jump.
  696.  
  697.      This means that when you reach the end of a loop after single
  698.      stepping though it, `until' will cause the program to continue
  699.      execution until the loop is exited.  In contrast, a `next'
  700.      command at the end of a loop will simply step back to the
  701.      beginning of the loop, which would force you to step through
  702.      the next iteration.
  703.  
  704.      `until' always stops the program if it attempts to exit the
  705.      current stack frame.
  706.  
  707.      `until' may produce somewhat counterintuitive results if the
  708.      order of machine code does not match the order of the source
  709.      lines.  For example, in the following excerpt from a debugging
  710.      session, the `f' (`frame') command shows that execution is
  711.      stopped at line `206'; yet when we use `until', we get to line
  712.      `195':
  713.  
  714.           (gdb) f
  715.           #0  main (argc=4, argv=0xf7fffae8) at m4.c:206
  716.           206                 expand_input();
  717.           (gdb) until
  718.           195             for ( ; argc > 0; NEXTARG) {
  719.  
  720.      This happened because, for execution efficiency, the compiler
  721.      had generated code for the loop closure test at the end, rather
  722.     
  723.      than the start, of the loop--even though the test in a C
  724.      `for'-loop is written before the body of the loop.  The `until'
  725.      command appeared to step back to the beginning of the loop when
  726.      it advanced to this expression; however, it has not really gone
  727.      to an earlier statement--not in terms of the actual machine code.
  728.  
  729.      `until' with no argument works by means of single instruction
  730.      stepping, and hence is slower than `until' with an argument.
  731.  
  732. `until LOCATION'
  733. `u LOCATION'
  734.      Continue running the program until either the specified location
  735.      is reached, or the current stack frame returns.  LOCATION is
  736.      any of the forms of argument acceptable to `break' (*note Set
  737.      Breaks::.).  This form of the command uses breakpoints, and
  738.      hence is quicker than `until' without an argument.
  739.  
  740. `stepi'
  741. `si'
  742.      Execute one machine instruction, then stop and return to the
  743.      debugger.
  744.  
  745.      It is often useful to do `display/i $pc' when stepping by
  746.      machine instructions.  This will cause the next instruction to
  747.      be executed to be displayed automatically at each stop.  *Note
  748.      Auto Display::.
  749.  
  750.      An argument is a repeat count, as in `step'.
  751.  
  752. `nexti'
  753. `ni'
  754.      Execute one machine instruction, but if it is a function call,
  755.      proceed until the function returns.
  756.  
  757.      An argument is a repeat count, as in `next'.
  758.  
  759. 
  760. File: gdb.info,  Node: Signals,  Prev: Continuing and Stepping,  Up: Stopping
  761.  
  762. Signals
  763. =======
  764.  
  765.    A signal is an asynchronous event that can happen in a program. 
  766. The operating system defines the possible kinds of signals, and
  767. gives each kind a name and a number.  For example, in Unix `SIGINT'
  768. is the signal a program gets when you type an interrupt (often
  769. `C-c'); `SIGSEGV' is the signal a program gets from referencing a
  770. place in memory far away from all the areas in use; `SIGALRM' occurs
  771. when the alarm clock timer goes off (which happens only if the
  772. program has requested an alarm).
  773.  
  774.    Some signals, including `SIGALRM', are a normal part of the
  775. functioning of the program.  Others, such as `SIGSEGV', indicate
  776. errors; these signals are "fatal" (kill the program immediately) if
  777. the program has not specified in advance some other way to handle
  778. the signal.  `SIGINT' does not indicate an error in the program, but
  779. it is normally fatal so it can carry out the purpose of the
  780. interrupt: to kill the program.
  781.  
  782.    GDB has the ability to detect any occurrence of a signal in the
  783. program running under GDB's control.  You can tell GDB in advance
  784. what to do for each kind of signal.
  785.  
  786.    Normally, GDB is set up to ignore non-erroneous signals like
  787. `SIGALRM' (so as not to interfere with their role in the functioning
  788. of the program) but to stop the program immediately whenever an
  789. error signal happens.  You can change these settings with the
  790. `handle' command.
  791.  
  792. `info signals'
  793.      Print a table of all the kinds of signals and how GDB has been
  794.      told to handle each one.  You can use this to see the signal
  795.      numbers of all the defined types of signals.
  796.  
  797. `handle SIGNAL KEYWORDS...'
  798.      Change the way GDB handles signal SIGNAL.  SIGNAL can be the
  799.      number of a signal or its name (with or without the `SIG' at
  800.      the beginning).  The KEYWORDS say what change to make.
  801.  
  802.    The keywords allowed by the `handle' command can be abbreviated. 
  803. Their full names are:
  804.  
  805. `nostop'
  806.      GDB should not stop the program when this signal happens.  It
  807.      may still print a message telling you that the signal has come
  808.      in.
  809.  
  810. `stop'
  811.      GDB should stop the program when this signal happens.  This
  812.      implies the `print' keyword as well.
  813.  
  814. `print'
  815.      GDB should print a message when this signal happens.
  816.  
  817. `noprint'
  818.      GDB should not mention the occurrence of the signal at all. 
  819.      This implies the `nostop' keyword as well.
  820.  
  821. `pass'
  822.      GDB should allow the program to see this signal; the program
  823.      will be able to handle the signal, or may be terminated if the
  824.      signal is fatal and not handled.
  825.  
  826. `nopass'
  827.      GDB should not allow the program to see this signal.
  828.  
  829.    When a signal has been set to stop the program, the program cannot
  830. see the signal until you continue.  It will see the signal then, if
  831. `pass' is in effect for the signal in question at that time.  In
  832. other words, after GDB reports a signal, you can use the `handle'
  833. command with `pass' or `nopass' to control whether that signal will
  834. be seen by the program when you later continue it.
  835.  
  836.    You can also use the `signal' command to prevent the program from
  837. seeing a signal, or cause it to see a signal it normally would not
  838. see, or to give it any signal at any time.  For example, if the
  839. program stopped due to some sort of memory reference error, you
  840. might store correct values into the erroneous variables and
  841. continue, hoping to see more execution; but the program would
  842. probably terminate immediately as a result of the fatal signal once
  843. it sees the signal.  To prevent this, you can continue with `signal
  844. 0'.  *Note Signaling::.
  845.  
  846. 
  847. File: gdb.info,  Node: Stack,  Next: Source,  Prev: Stopping,  Up: Top
  848.  
  849. Examining the Stack
  850. *******************
  851.  
  852.    When your program has stopped, the first thing you need to know is
  853. where it stopped and how it got there.
  854.  
  855.    Each time your program performs a function call, the information
  856. about where in the program the call was made from is saved in a
  857. block of data called a "stack frame".  The frame also contains the
  858. arguments of the call and the local variables of the function that
  859. was called.  All the stack frames are allocated in a region of
  860. memory called the "call stack".
  861.  
  862.    When your program stops, the GDB commands for examining the stack
  863. allow you to see all of this information.
  864.  
  865.    One of the stack frames is "selected" by GDB and many GDB commands
  866. refer implicitly to the selected frame.  In particular, whenever you
  867. ask GDB for the value of a variable in the program, the value is
  868. found in the selected frame.  There are special GDB commands to
  869. select whichever frame you are interested in.
  870.  
  871.    When the program stops, GDB automatically selects the currently
  872. executing frame and describes it briefly as the `frame' command does
  873. (*note Info: Frame Info.).
  874.  
  875. * Menu:
  876.  
  877. * Frames::                      Stack Frames
  878. * Backtrace::                   Backtraces
  879. * Selection::                   Selecting a Frame
  880. * Frame Info::                  Information on a Frame
  881.  
  882. 
  883. File: gdb.info,  Node: Frames,  Next: Backtrace,  Prev: Stack,  Up: Stack
  884.  
  885. Stack Frames
  886. ============
  887.  
  888.    The call stack is divided up into contiguous pieces called "stack
  889. frames", or "frames" for short; each frame is the data associated
  890. with one call to one function.  The frame contains the arguments
  891. given to the function, the function's local variables, and the
  892. address at which the function is executing.
  893.  
  894.    When your program is started, the stack has only one frame, that
  895. of the function `main'.  This is called the "initial" frame or the
  896. "outermost" frame.  Each time a function is called, a new frame is
  897. made.  Each time a function returns, the frame for that function
  898. invocation is eliminated.  If a function is recursive, there can be
  899. many frames for the same function.  The frame for the function in
  900. which execution is actually occurring is called the "innermost"
  901. frame.  This is the most recently created of all the stack frames
  902. that still exist.
  903.  
  904.    Inside your program, stack frames are identified by their
  905. addresses.  A stack frame consists of many bytes, each of which has
  906. its own address; each kind of computer has a convention for choosing
  907. one of those bytes whose address serves as the address of the frame.
  908. Usually this address is kept in a register called the "frame pointer
  909. register" while execution is going on in that frame.
  910.  
  911.    GDB assigns numbers to all existing stack frames, starting with
  912. zero for the innermost frame, one for the frame that called it, and
  913. so on upward.  These numbers do not really exist in your program;
  914. they are assigned by GDB to give you a way of designating stack
  915. frames in GDB commands.
  916.  
  917.    Some compilers allow functions to be compiled so that they operate
  918. without stack frames.  (For example, the `gcc' option
  919. `-fomit-frame-pointer' will generate functions without a frame.)
  920. This is occasionally done with heavily used library functions to
  921. save the frame setup time.  GDB has limited facilities for dealing
  922. with these function invocations.  If the innermost function
  923. invocation has no stack frame, GDB will nevertheless regard it as
  924. though it had a separate frame, which is numbered zero as usual,
  925. allowing correct tracing of the function call chain.  However, GDB
  926. has no provision for frameless functions elsewhere in the stack.
  927.  
  928. 
  929. File: gdb.info,  Node: Backtrace,  Next: Selection,  Prev: Frames,  Up: Stack
  930.  
  931. Backtraces
  932. ==========
  933.  
  934.    A backtrace is a summary of how the program got where it is.  It
  935. shows one line per frame, for many frames, starting with the
  936. currently executing frame (frame zero), followed by its caller
  937. (frame one), and on up the stack.
  938.  
  939. `backtrace'
  940. `bt'
  941.      Print a backtrace of the entire stack: one line per frame for
  942.      all frames in the stack.
  943.  
  944.      You can stop the backtrace at any time by typing the system
  945.      interrupt character, normally `C-c'.
  946.  
  947. `backtrace N'
  948. `bt N'
  949.      Similar, but print only the innermost N frames.
  950.  
  951. `backtrace -N'
  952. `bt -N'
  953.      Similar, but print only the outermost N frames.
  954.  
  955.    The names `where' and `info stack' (abbreviated `info s') are
  956. additional aliases for `backtrace'.
  957.  
  958.    Each line in the backtrace shows the frame number and the function
  959. name.  The program counter value is also shown--unless you use `set
  960. print address off'.  The backtrace also shows the source file name
  961. and line number, as well as the arguments to the function.  The
  962. program counter value is omitted if it is at the beginning of the
  963. code for that line number.
  964.  
  965.    Here is an example of a backtrace.  It was made with the command
  966. `bt 3', so it shows the innermost three frames.
  967.  
  968.      #0  m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8) at builtin.c:993
  969.      #1  0x6e38 in expand_macro (sym=0x2b600) at macro.c:242
  970.      #2  0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08)
  971.          at macro.c:71
  972.      (More stack frames follow...)
  973.  
  974. The display for frame zero doesn't begin with a program counter
  975. value, indicating that the program has stopped at the beginning of
  976. the code for line `993' of `builtin.c'.
  977.  
  978. 
  979. File: gdb.info,  Node: Selection,  Next: Frame Info,  Prev: Backtrace,  Up: Stack
  980.  
  981. Selecting a Frame
  982. =================
  983.  
  984.    Most commands for examining the stack and other data in the
  985. program work on whichever stack frame is selected at the moment. 
  986. Here are the commands for selecting a stack frame; all of them
  987. finish by printing a brief description of the stack frame just
  988. selected.
  989.  
  990. `frame N'
  991. `f N'
  992.      Select frame number N.  Recall that frame zero is the innermost
  993.      (currently executing) frame, frame one is the frame that called
  994.      the innermost one, and so on.  The highest-numbered frame is
  995.      `main''s frame.
  996.  
  997. `frame ADDR'
  998. `f ADDR'
  999.      Select the frame at address ADDR.  This is useful mainly if the
  1000.      chaining of stack frames has been damaged by a bug, making it
  1001.      impossible for GDB to assign numbers properly to all frames. 
  1002.      In addition, this can be useful when the program has multiple
  1003.      stacks and switches between them.
  1004.  
  1005.      _if_(1) On the SPARC architecture, `frame' needs two addresses
  1006.      to select an arbitrary frame: a frame pointer and a stack
  1007.      pointer.   _fi_(1)
  1008.  
  1009. `up N'
  1010.      Move N frames up the stack.  For positive numbers N, this
  1011.      advances toward the outermost frame, to higher frame numbers,
  1012.      to frames that have existed longer.  N defaults to one.
  1013.  
  1014. `down N'
  1015.      Move N frames down the stack.  For positive numbers N, this
  1016.      advances toward the innermost frame, to lower frame numbers, to
  1017.      frames that were created more recently.  N defaults to one. 
  1018.      You may abbreviate `down' as `do'.
  1019.  
  1020.    All of these commands end by printing two lines of output
  1021. describing the frame.  The first line shows the frame number, the
  1022. function name, the arguments, and the source file and line number of
  1023. execution in that frame.  The second line shows the text of that
  1024. source line.  For example:
  1025.  
  1026.      (gdb) up
  1027.      #1  0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc) at env.c:10
  1028.      10              read_input_file (argv[i]);
  1029.  
  1030.    After such a printout, the `list' command with no arguments will
  1031. print ten lines centered on the point of execution in the frame. 
  1032. *Note List::.
  1033.  
  1034. `up-silently N'
  1035. `down-silently N'
  1036.      These two commands are variants of `up' and `down',
  1037.      respectively; they differ in that they do their work silently,
  1038.      without causing display of the new frame.  They are intended
  1039.      primarily for use in GDB command scripts, where the output
  1040.      might be unnecessary and distracting.
  1041.  
  1042. 
  1043. File: gdb.info,  Node: Frame Info,  Prev: Selection,  Up: Stack
  1044.  
  1045. Information About a Frame
  1046. =========================
  1047.  
  1048.    There are several other commands to print information about the
  1049. selected stack frame.
  1050.  
  1051. `frame'
  1052. `f'
  1053.      When used without any argument, this command does not change
  1054.      which frame is selected, but prints a brief description of the
  1055.      currently selected stack frame.  It can be abbreviated `f'. 
  1056.      With an argument, this command is used to select a stack frame
  1057.      (*note Selection::.).
  1058.  
  1059. `info frame'
  1060. `info f'
  1061.      This command prints a verbose description of the selected stack
  1062.      frame, including the address of the frame, the addresses of the
  1063.      next frame down (called by this frame) and the next frame up
  1064.      (caller of this frame), the address of the frame's arguments,
  1065.      the program counter saved in it (the address of execution in
  1066.      the caller frame), and which registers were saved in the frame.
  1067.      The verbose description is useful when something has gone wrong
  1068.      that has made the stack format fail to fit the usual conventions.
  1069.  
  1070. `info frame ADDR'
  1071. `info f ADDR'
  1072.      Print a verbose description of the frame at address ADDR,
  1073.      without selecting that frame.  The selected frame remains
  1074.      unchanged by this command.
  1075.  
  1076. `info args'
  1077.      Print the arguments of the selected frame, each on a separate
  1078.      line.
  1079.  
  1080. `info locals'
  1081.      Print the local variables of the selected frame, each on a
  1082.      separate line.  These are all variables declared static or
  1083.      automatic within all program blocks that execution in this
  1084.      frame
  1085.      is currently inside of.
  1086.  
  1087. `info catch'
  1088.      Print a list of all the exception handlers that are active in
  1089.      the current stack frame at the current point of execution.  To
  1090.      see other exception handlers, visit the associated frame (using
  1091.      the `up', `down', or `frame' commands); then type `info catch'.
  1092.      *Note Exception Handling::.
  1093.  
  1094. 
  1095. File: gdb.info,  Node: Source,  Next: Data,  Prev: Stack,  Up: Top
  1096.  
  1097. Examining Source Files
  1098. **********************
  1099.  
  1100.    GDB can print parts of your program's source, since the debugging
  1101. information recorded in your program tells GDB what source files
  1102. were used to built it.  When your program stops, GDB spontaneously
  1103. prints the line where it stopped.  Likewise, when you select a stack
  1104. frame (*note Selection::.), GDB prints the line where execution in
  1105. that frame has stopped.  You can print other portions of source
  1106. files by explicit command.
  1107.  
  1108.    If you use GDB through its GNU Emacs interface, you may prefer to
  1109. use Emacs facilities to view source; *note Emacs::..
  1110.  
  1111. * Menu:
  1112.  
  1113. * List::                        Printing Source Lines
  1114. * Search::                      Searching Source Files
  1115. * Source Path::                 Specifying Source Directories
  1116. * Machine Code::                Source and Machine Code
  1117.  
  1118. 
  1119. File: gdb.info,  Node: List,  Next: Search,  Prev: Source,  Up: Source
  1120.  
  1121. Printing Source Lines
  1122. =====================
  1123.  
  1124.    To print lines from a source file, use the `list' command
  1125. (abbreviated `l').  There are several ways to specify what part of
  1126. the file you want to print.
  1127.  
  1128.    Here are the forms of the `list' command most commonly used:
  1129.  
  1130. `list LINENUM'
  1131.      Print ten lines centered around line number LINENUM in the
  1132.      current source file.
  1133.  
  1134. `list FUNCTION'
  1135.      Print ten lines centered around the beginning of function
  1136.      FUNCTION.
  1137.  
  1138. `list'
  1139.      Print ten more lines.  If the last lines printed were printed
  1140.      with a `list' command, this prints ten lines following the last
  1141.      lines printed; however, if the last line printed was a solitary
  1142.      line printed as part of displaying a stack frame (*note
  1143.      Stack::.), this prints ten lines centered around that line.
  1144.  
  1145. `list -'
  1146.      Print ten lines just before the lines last printed.
  1147.  
  1148.    Repeating a `list' command with RET discards the argument, so it
  1149. is equivalent to typing just `list'.  This is more useful than
  1150. listing the same lines again.  An exception is made for an argument
  1151. of `-'; that argument is preserved in repetition so that each
  1152. repetition moves up in the source file.
  1153.  
  1154.    In general, the `list' command expects you to supply zero, one or
  1155. two "linespecs".  Linespecs specify source lines; there are several
  1156. ways of writing them but the effect is always to specify some source
  1157. line.  Here is a complete description of the possible arguments for
  1158. `list':
  1159.  
  1160. `list LINESPEC'
  1161.      Print ten lines centered around the line specified by LINESPEC.
  1162.  
  1163. `list FIRST,LAST'
  1164.      Print lines from FIRST to LAST.  Both arguments are linespecs.
  1165.  
  1166. `list ,LAST'
  1167.      Print ten lines ending with LAST.
  1168.  
  1169. `list FIRST,'
  1170.      Print ten lines starting with FIRST.
  1171.  
  1172. `list +'
  1173.      Print ten lines just after the lines last printed.
  1174.  
  1175. `list -'
  1176.      Print ten lines just before the lines last printed.
  1177.  
  1178. `list'
  1179.      As described in the preceding table.
  1180.  
  1181.    Here are the ways of specifying a single source line--all the
  1182. kinds of linespec.
  1183.  
  1184. `NUMBER'
  1185.      Specifies line NUMBER of the current source file.  When a `list'
  1186.      command has two linespecs, this refers to the same source file
  1187.      as the first linespec.
  1188.  
  1189. `+OFFSET'
  1190.      Specifies the line OFFSET lines after the last line printed. 
  1191.      When used as the second linespec in a `list' command that has
  1192.      two, this specifies the line OFFSET lines down from the first
  1193.      linespec.
  1194.  
  1195. `-OFFSET'
  1196.      Specifies the line OFFSET lines before the last line printed.
  1197.  
  1198. `FILENAME:NUMBER'
  1199.      Specifies line NUMBER in the source file FILENAME.
  1200.  
  1201. `FUNCTION'
  1202.      Specifies the line of the open-brace that begins the body of the
  1203.      function FUNCTION.
  1204.  
  1205. `FILENAME:FUNCTION'
  1206.      Specifies the line of the open-brace that begins the body of the
  1207.      function FUNCTION in the file FILENAME.  You only need the file
  1208.      name with a function name to avoid ambiguity when there are
  1209.      identically named functions in different source files.
  1210.  
  1211. `*ADDRESS'
  1212.      Specifies the line containing the program address ADDRESS. 
  1213.      ADDRESS may be any expression.
  1214.  
  1215. 
  1216. File: gdb.info,  Node: Search,  Next: Source Path,  Prev: List,  Up: Source
  1217.  
  1218. Searching Source Files
  1219. ======================
  1220.  
  1221.    There are two commands for searching through the current source
  1222. file for a regular expression.
  1223.  
  1224. `forward-search REGEXP'
  1225. `search REGEXP'
  1226.      The command `forward-search REGEXP' checks each line, starting
  1227.      with the one following the last line listed, for a match for
  1228.      REGEXP.  It lists the line that is found.  You can abbreviate
  1229.      the command name as `fo'.  The synonym `search REGEXP' is also
  1230.      supported.
  1231.  
  1232. `reverse-search REGEXP'
  1233.      The command `reverse-search REGEXP' checks each line, starting
  1234.      with the one before the last line listed and going backward,
  1235.      for a match for REGEXP.  It lists the line that is found.  You
  1236.      can abbreviate this command as `rev'.
  1237.  
  1238.